package com.opencloud.ywt.provider.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.opencloud.common.model.PageParams;
import com.opencloud.ywt.client.model.entity.BhyfBflBody;
import com.opencloud.ywt.client.model.entity.BhyfBflBodyInfo;
import com.opencloud.ywt.client.model.entity.BhyfXhbWhoBmi;
import com.opencloud.ywt.client.model.entity.BhyfXhbWhoHw;
import com.opencloud.ywt.provider.mapper.BhyfBflBodyMapper;
import com.opencloud.ywt.provider.mapper.BhyfXhbWhoBmiMapper;
import com.opencloud.ywt.provider.mapper.BhyfXhbWhoHwMapper;
import com.opencloud.ywt.provider.service.BhyfBodyService;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 动量服务
 * @author yeyong
 */

@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class BhyfBodyServiceImpl implements BhyfBodyService {
    @Autowired
    private BhyfBflBodyMapper bhyfBflBodyMapper;


    @Autowired
    private BhyfXhbWhoBmiMapper bhyfXhbWhoBmiMapper;

    @Autowired
    private BhyfXhbWhoHwMapper bhyfXhbWhoHwMapper;

    @Override
    public List<BhyfBflBody> findBflBodyTongJiList(Integer gid,String starttime,String endtime) {
        return bhyfBflBodyMapper.getBflBodyTongJi(gid,starttime,endtime);
    }


    @Override
    public List<BhyfBflBodyInfo> findBflBodyInfoList(Integer gid,Integer gradeid, Integer classid, String starttime, String endtime, Integer personid) {
        return bhyfBflBodyMapper.getLastBflBodyCheckList(gid,gradeid,classid,starttime,endtime,personid);
    }

    @Override
    public BhyfXhbWhoBmi getBhyfXhbWhoBmi(Integer sex, Double height)
    {
        return bhyfXhbWhoBmiMapper.getTheBmi(sex,height);
    }

    @Override
    public BhyfXhbWhoHw getBhyfXhbWhoHw(Integer sex, Integer type,Integer age)
    {
        return bhyfXhbWhoHwMapper.getTheHw(sex,type,age);
    }

    @Override
    public List<BhyfBflBodyInfo> findPersonBodyMonthList(String starttime, String endtime, Integer personid) {
        return bhyfBflBodyMapper.getPersonBodyMonthList(starttime,endtime,personid);
    }
}